package com.hxzy.consumer.mq01;

import com.hxzy.comm.Constants;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * @Author wy
 * @Description 消费者
 * @Date 2023/5/24 16:24
 * @Version 1.0
 */
@Service
public class DemoConsumer {

    /**
     * 订阅了  queue="demo"的消息队列,一旦队列有消息了，就会把消息推送到这里
     * @param message
     */
    @RabbitListener(queues = {Constants.QUEUE_DEMO})
    @RabbitHandler
    public void  receiver_demo_mq01(String message) throws InterruptedException {
        System.out.println("rabbitmq01_consumer-DemoConsumer-收到queue=demo的消息");

        System.out.println(message);
        System.out.println("---------------------------------------");
    }



}
